/**
 * Copyright (c) 2015 www.smarthome.com All rights reserved. <br />
 * 本软件源代码版权归xxxx公司,未经许可不得任意复制与传播.<br />
 *
 */
package com.smarthome.domain.enums;

import java.io.Serializable;

/**
 *
 * AccountStatus 账户状态的枚举类
 *
 * @author KongXiangyu
 *
 * @since 1.0
 */
public enum AccountStatus implements Serializable {
    DELETED(0,"删除"), NORMAL(1, "正常"), LIMITED(2, "受限"),
    FREEZE(3, "冻结"), LOGOUT(4, "注销"), UNCHECK(5,"待审核");

    private int type;
    private String accountStatus;// 账户状态

    private AccountStatus(int type, String accountStatus) {
        this.type = type;
        this.accountStatus = accountStatus;
    }

    public int getType() {
        return type;
    }

    public String getAccountStatus() {
        return accountStatus;
    }

    public static AccountStatus getByType(int type) {
        for (AccountStatus accountStatus : values()) {
            if (accountStatus.getType() == type) {
                return accountStatus;
            }
        }
        throw new IllegalArgumentException("none-defined accountStatus type,type:" + type);
    }

    public static String getName(int index) {
        for (AccountStatus c : AccountStatus.values()) {
            if (c.getType() == index) {
                return c.accountStatus;
            }
        }
        return null;
    }
}
